
#include "MiscFuncs.h"

/*-----------------------------------------------------------------------------
| Finds context-wide resource groups.
-----------------------------------------------------------------------------*/
void locateResources(const Ogre::String& resources_cfg)
{
	// load resource paths from config file
	Ogre::ConfigFile cf;
	cf.load(resources_cfg);

	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
	Ogre::String sec, type, arch;

	// go through all specified resource groups
	while (seci.hasMoreElements())
	{
		sec = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;

		// go through all resource paths
		for (i = settings->begin(); i != settings->end(); i++)
		{
			type = i->first;
			arch = i->second;

			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch, type, sec);
		}
	}
}

/*-----------------------------------------------------------------------------
| Loads context-wide resource groups.
-----------------------------------------------------------------------------*/
void loadResources()
{
	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
} 
